home *** CD-ROM | disk | FTP | other *** search
- Path: nuscc.nus.sg!chiateck
- From: chiateck@iscs.nus.sg (Chia Teck Chin Joseph)
- Newsgroups: comp.lang.c++
- Subject: Visual C++ and DLL
- Date: 16 Feb 1996 06:36:19 GMT
- Organization: National University of Singapore
- Message-ID: <4g18l3$j55@nuscc.nus.sg>
- NNTP-Posting-Host: chiateck@sununx.iscs.nus.sg
- X-Newsreader: TIN [version 1.2 PL2]
-
- Hi,
- I am having a hard time with the following problem:
-
- I am writing a dll in MSVC++2.1 on NT3.5.
-
- In this dll, i am retrieveing some data from a remote
- computer,storing it in CStringArray.
-
- Subsequently, clients can call functions in this dll to retrieve the
- data.
-
- I found that the following does not return the char* properly.
-
- ---------------------------------------------------------------------------
-
- void retrieve(char* s)
- {
- CString temp=happy->GetAt(0);
- strncpy(s,temp,temp.GetLength());
- return;
- };
-
- prior to calling this function, user would need to call another
- function in the dll, as below:
-
- void initialise()
- {
- temp->SetSize(50,10);
-
- //retrieve data from remote site and store in CStringArray
- ...
-
- return;
- };
-
- Note: happy is a CStringArray* declared as a global variable in the dll.
-
- I am using explicit dynamic loading. But I don't think it matters.
-
- I tried several other ways, like copying the contents from the CString
- bit by bit, but still upon returning, the value doesn't stick to the
- parameter char* s?
-
- I have spent so much time, 2 weeks on this problem, to no avail.
-
- I am now desperate, pls...if anyone knows the answer,
- pls tell me what is going wrong! I am going insane.
-
- I have also posted this problem in the MFC group but has yet to
- receive any replies.
-
- Pls, if anyone knows, pls answer...
- I am doing this as a school project... deadline's up!!
-
- ----------------------------------------------------------------------------
- Joseph Chia Email:chiateck@iscs.nus.sg
- ----------------------------------------------------------------------------
-